package com.github.kezhenxu94.playground.java.sorting;

public class ShellSort {

	public void sort(int[] array) {
		int len = array.length;
		for (int d = len / 2; d > 0; d /= 2) {
			for (int i = d; i < len; i += d) {
				int temp = array[i];
				int j = i;
				for (; j - d >= 0 && temp < array[j - d]; j -= d) {
					array[j] = array[j - d];
				}
				array[j] = temp;
			}
		}
	}

}
